
package com.xm9m.ibczy.mytest.alimama.mobile.demo;

import android.content.Intent;
import android.os.Bundle;
import android.view.ViewGroup;

import com.alimama.mobile.sdk.MmuSDK;
import com.alimama.mobile.sdk.config.MmuSDKFactory;
import com.alimama.mobile.sdk.config.TextLinkProperties;
import com.xm9m.ibczy.mytest.R;

public class TextLinkActivity extends BaseActivity {
    private TextLinkProperties properties;
	private MmuSDK mmuSDK;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.hyperlinktext);
        setTitle("文字链");

        ViewGroup nat = (ViewGroup) findViewById(R.id.link_root);
        String slotId = "54367";//注意：该广告位只做测试使用，请勿集成到发布版app中
        setupAlimama(nat, slotId);

    }

    private void setupAlimama(ViewGroup nat, String slotId) {
        mmuSDK = MmuSDKFactory.getMmuSDK();
        mmuSDK.accountServiceInit(this);
        mmuSDK.init(getApplication());//初始化SDK,该方法必须保证在集成代码前调用，可移到程序入口处调用
        properties = new TextLinkProperties(slotId, nat);
        mmuSDK.attach(properties);
    }
    
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    	if (!mmuSDK.accountServiceHandleResult(requestCode, resultCode, data,this)) {
			super.onActivityResult(requestCode, resultCode, data);
		}
    }
}
